using System;
using System.ComponentModel;

namespace Mistral.ComponentModel
{
	public class CustomTypeProvider : TypeDescriptionProvider
	{
		ICustomTypeDescriptor _customTypeDescriptor;

		public CustomTypeProvider( ICustomTypeDescriptor customTypeDescriptor )
		{
			_customTypeDescriptor = customTypeDescriptor;
		}
		
		///<summary>
		///Gets a custom type descriptor for the given type and object.
		///</summary>
		///
		///<returns>
		///An <see cref="T:System.ComponentModel.ICustomTypeDescriptor"></see> that can provide metadata for the type.
		///</returns>
		///
		///<param name="objectType">The type of object for which to retrieve the type descriptor.</param>
		///<param name="instance">An instance of the type. Can be null if no instance was passed to the <see cref="T:System.ComponentModel.TypeDescriptor"></see>.</param>
		public override ICustomTypeDescriptor GetTypeDescriptor( Type objectType, object instance )
		{
			return _customTypeDescriptor;
		}	
	}
}